package com.thread.test06;

/**
 * @author bin
 * @date 2025 - 03 -10
 **/
public class Sum implements Runnable{
    private int start;

    private int end;

    private int sum;

    public Sum() {
    }
    public Sum(int start, int end) {
        this.start = start;
        this.end = end;
    }

    public Sum(int start, int end, int sum) {
        this.start = start;
        this.end = end;
        this.sum = sum;
    }

    public int getStart() {
        return start;
    }
    public void setStart(int start) {
        this.start = start;
    }
    public int getEnd() {
        return end;
    }
    public void setEnd(int end) {
        this.end = end;
    }
    public int getSum() {
        return sum;
    }
    public void setSum(int sum) {
        this.sum = sum;
    }

    @Override
    public void run() {
        this.sum = 0;
        for (int i = start; i <= end; i++) {
            sum += i;
        }
    }
}
